package system.service.sys.impl;

import lombok.Getter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import system.entity.SysRole;
import system.entity.SysRolePermission;
import system.mapper.SysRoleMapper;
import system.mapper.SysRolePermissionMapper;
import system.service.sys.SysRoleService;

@Service
public class SysRoleServiceImpl implements SysRoleService {
    @Autowired
    @Getter
    private SysRoleMapper mapper;
    @Autowired
    private SysRolePermissionMapper permissionMapper;

    @Override
    @Transactional
    public Integer deleteById(Integer id) {
        int rows = 0;
        rows += SysRoleService.super.deleteById(id);
        SysRolePermission sysRolePermission = new SysRolePermission();
        sysRolePermission.setRoleId(id);
        rows += permissionMapper.delete(sysRolePermission);
        return rows;
    }

}